From 2096c95b26258c78659e2f9be77386ae4f3b3ad2 Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou Date: Mon, 6 Feb 2017 17:58:04 +0100 Subject: [PATCH] tests: fix git User-Agent for Windows Signed-off-by: Marc-Antoine Perennou --- tests/build-auth.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/build-auth.rs b/tests/build-auth.rs index c34603972..b350d6671 100644 --- a/tests/build-auth.rs +++ b/tests/build-auth.rs @@ -33,6 +33,11 @@ fn http_auth_offered() { let t = thread::spawn(move|| { let mut conn = BufStream::new(server.accept().unwrap().0); let req = headers(&mut conn); + let user_agent = if cfg!(windows) { + "User-Agent: git/1.0 (libgit2 0.25.0)" + } else { + "User-Agent: git/2.0 (libgit2 0.25.0)" + }; conn.write_all(b"\ HTTP/1.1 401 Unauthorized\r\n\ WWW-Authenticate: Basic realm=\"wheee\"\r\n @@ -41,7 +46,7 @@ fn http_auth_offered() { assert_eq!(req, vec![ "GET /foo/bar/info/refs?service=git-upload-pack HTTP/1.1", "Accept: */*", - "User-Agent: git/2.0 (libgit2 0.25.0)", + user_agent, ].into_iter().map(|s| s.to_string()).collect()); drop(conn); @@ -56,7 +61,7 @@ fn http_auth_offered() { "GET /foo/bar/info/refs?service=git-upload-pack HTTP/1.1", "Authorization: Basic Zm9vOmJhcg==", "Accept: */*", - "User-Agent: git/2.0 (libgit2 0.25.0)", + user_agent, ].into_iter().map(|s| s.to_string()).collect()); }); -- 2.30.2